-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(formatting): Add memory units adaptive formatter to format bytes #30559
base: master
Are you sure you want to change the base?
Conversation
I've created a discussion for this PR as well: #30558 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great feature, and one that many have been looking forward to seeing. In general this looks good, but would you be able to add some unit tests?
@villebro , sure thing, let me give it a try :) I never wrote any Javascript before, therefore happy to get some feedback :) |
- Make decimals option a parameter of MemoryFormatter - Handle negative values in MemoryFormatter - Handle values exceeding maximal unit value in MemoryFormatter
@villebro I added unit tests and fixed some bugs on the way :) Let me know what you think! |
Add new memory units adaptive formatter to format bytes units into kB, MB, GB, etc.
SUMMARY
Memory unit (bytes) is typically formatted into kB (kilobytes), MB (megabytes), etc.
Superset formatting options don't enable adaptive formatting with proper unit naming in case of bytes values.
There are two most commonly used multi-byte unit types (according to wikipedia), this PR implements them both.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION